package com.qianfeng.gl4study.youshare.model;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

/**
 * 商品属性类
 * Created with IntelliJ IDEA.
 * I'm glad to share my knowledge with you all.
 * User:Gaolei
 * Date:2015/2/3
 * Email:pdsfgl@live.com
 */
public class Product implements Serializable{

	/*
	"app_gname": "酷晨智能铁鼎",
	"goods_name": "韩国CUCHEN\/酷晨智能电饭...",
	"type": "0",
	"url": "goods.php?id=138",
	"goods_img": "images\/no_picture.gif",
	"promote_price": "",
	"goods_brief": "来自韩国进口，世界领先的智能环绕IH加热",
	"shop_price": "￥3499元",
	"market_price": "￥4999元",
	"name": "韩国CUCHEN\/酷晨智能电饭煲锅名品铁鼎",
	"goods_id": "138",
	"goods_style_name": "韩国CUCHEN\/酷晨智能电饭煲锅名品铁鼎",
	"goods_thumb": "images\/201410\/thumb_img\/138_thumb_G_1414752338260.png",
	"add_time": "2014-10-17"
	*/

	private String appGname;        //"app_gname": "酷晨智能铁鼎",
	private String goodsName;       //"goods_name": "韩国CUCHEN\/酷晨智能电饭...",
	private String type;            //"type": "0",
	private String url;             //"url": "goods.php?id=138",
	private String goodsImg;        //"goods_img": "images\/no_picture.gif",
	private String promotePrice;    //"promote_price": "",
	private String goodsBrief;      //"goods_brief": "来自韩国进口，世界领先的智能环绕IH加热",
	private String shopPrice;       //"shop_price": "￥3499元",
	private String marketPrice;     //"market_price": "￥4999元",
	private String name;            //"name": "韩国CUCHEN\/酷晨智能电饭煲锅名品铁鼎",
	private String goodsId;         //"goods_id": "138",
	private String goodsStyle_name; //"goods_style_name": "韩国CUCHEN\/酷晨智能电饭煲锅名品铁鼎",
	private String goodsThumb;      //"goods_thumb": "images\/201410\/thumb_img\/138_thumb_G_1414752338260.png",
	private String addTime;         //"add_time": "2014-10-17"


	public String getAppGname() {
		return appGname;
	}

	public void setAppGname(String appGname) {
		this.appGname = appGname;
	}

	public String getGoodsName() {
		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getGoodsImg() {
		return goodsImg;
	}

	public void setGoodsImg(String goodsImg) {
		this.goodsImg = goodsImg;
	}

	public String getPromotePrice() {
		return promotePrice;
	}

	public void setPromotePrice(String promotePrice) {
		this.promotePrice = promotePrice;
	}

	public String getGoodsBrief() {
		return goodsBrief;
	}

	public void setGoodsBrief(String goodsBrief) {
		this.goodsBrief = goodsBrief;
	}

	public String getShopPrice() {
		return shopPrice;
	}

	public void setShopPrice(String shopPrice) {
		this.shopPrice = shopPrice;
	}

	public String getMarketPrice() {
		return marketPrice;
	}

	public void setMarketPrice(String marketPrice) {
		this.marketPrice = marketPrice;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(String goodsId) {
		this.goodsId = goodsId;
	}

	public String getGoodsStyle_name() {
		return goodsStyle_name;
	}

	public void setGoodsStyle_name(String goodsStyle_name) {
		this.goodsStyle_name = goodsStyle_name;
	}

	public String getGoodsThumb() {
		return goodsThumb;
	}

	public void setGoodsThumb(String goodsThumb) {
		this.goodsThumb = goodsThumb;
	}

	public String getAddTime() {
		return addTime;
	}

	public void setAddTime(String addTime) {
		this.addTime = addTime;
	}

	/**
	 * 解析Json数据
	 * @param json
	 */
	public void parseJSON(JSONObject json){
		if (json!=null){
			try {
			type = json.getString("type");
			name = json.getString("name");
			goodsImg = json.getString("goods_img");
			goodsId = json.getString("goods_id");
			goodsThumb = json.getString("goods_thumb");
			shopPrice = json.getString("shop_price");

			appGname = json.optString("app_gname");
			goodsName = json.optString("goods_name");
			url = json.optString("url");
			promotePrice = json.optString("promote_price");
			goodsBrief = json.optString("goods_brief");
			marketPrice = json.optString("market_price");
			goodsStyle_name = json.optString("goods_style_name");
			addTime = json.optString("add_time");

			} catch (JSONException e) {
			e.printStackTrace();
		}
		}

	}



}
